package com.lindroid.androiduilearning.expandablelistview;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;

import com.lindroid.androiduilearning.R;
import com.lindroid.androiduilearning.expandablelistview.adapter.MyExpandableListAdapter;

/**
 * @author Lin
 * @date 2018/4/17
 * @function ExpandableListView的通常用法
 */

public class CommonFragment extends BaseExpandableFragment {
    private ExpandableListView expandableList;

    public static CommonFragment newInstance() {
        Bundle args = new Bundle();
        CommonFragment fragment = new CommonFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        View view = View.inflate(context, R.layout.fragment_expandable_com, null);
        initView(view);
        return view;
    }

    private void initView(View view) {
        expandableList = view.findViewById(R.id.expandable_list);
        expandableList.setAdapter(new MyExpandableListAdapter(context, groupList, childList));
    }
}
